Kuberwastaken commited on
Commit
8f4c447
·
1 Parent(s): f27f774

Fixed Searching Movies

Browse files
__pycache__/script_search_api.cpython-310.pyc CHANGED
Binary files a/__pycache__/script_search_api.cpython-310.pyc and b/__pycache__/script_search_api.cpython-310.pyc differ
 
gradio_app.py CHANGED
@@ -3,6 +3,10 @@ from model.analyzer import analyze_content
3
  import asyncio
4
  import time
5
  import httpx
 
 
 
 
6
 
7
  custom_css = """
8
  * {
@@ -213,6 +217,19 @@ footer {
213
  100% { transform: scale(1); }
214
  }
215
  """
 
 
 
 
 
 
 
 
 
 
 
 
 
216
 
217
  async def fetch_and_analyze_script(movie_name, progress=gr.Progress(track_tqdm=True)):
218
  try:
@@ -373,6 +390,8 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as iface:
373
  </div>
374
  """)
375
 
 
 
376
  if __name__ == "__main__":
377
  iface.launch(
378
  share=False,
 
3
  import asyncio
4
  import time
5
  import httpx
6
+ import subprocess
7
+ import signal
8
+ import atexit
9
+
10
 
11
  custom_css = """
12
  * {
 
217
  100% { transform: scale(1); }
218
  }
219
  """
220
+ # Start the API server
221
+ def start_api_server():
222
+ # Start uvicorn in a subprocess
223
+ process = subprocess.Popen(["uvicorn", "script_search_api:app", "--reload"])
224
+ return process
225
+
226
+ # Stop the API server
227
+ def stop_api_server(process):
228
+ process.terminate()
229
+
230
+ # Register the exit handler
231
+ api_process = start_api_server()
232
+ atexit.register(stop_api_server, api_process)
233
 
234
  async def fetch_and_analyze_script(movie_name, progress=gr.Progress(track_tqdm=True)):
235
  try:
 
390
  </div>
391
  """)
392
 
393
+ # Launch the Gradio interface
394
+
395
  if __name__ == "__main__":
396
  iface.launch(
397
  share=False,
requirements.txt CHANGED
@@ -10,4 +10,7 @@ bs4
10
  httpx
11
  flask
12
  flask_cors
13
- transformers
 
 
 
 
10
  httpx
11
  flask
12
  flask_cors
13
+ transformers
14
+ subprocess
15
+ signal
16
+ atexit