marks commited on
Commit
37bed65
·
1 Parent(s): f12f1e5

Moved to Uvicorn instead of Flask

Browse files
Files changed (3) hide show
  1. README.md +8 -2
  2. app.py +7 -5
  3. requirements.txt +3 -2
README.md CHANGED
@@ -7,8 +7,14 @@ sdk: gradio
7
  sdk_version: "5.12.0"
8
  app_file: app.py
9
  pinned: false
10
- short_description: A Podcast Generator
11
- python_version: 3.12
12
  ---
13
 
 
 
 
 
 
 
14
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
7
  sdk_version: "5.12.0"
8
  app_file: app.py
9
  pinned: false
10
+ short_description: A Podcast Generator powered by FastAPI and Gradio
11
+ python_version: "3.12"
12
  ---
13
 
14
+ # URL to Podcast Generator
15
+
16
+ A FastAPI application with Gradio interface for generating podcasts from web content.
17
+
18
+ ## Running the Application
19
+
20
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py CHANGED
@@ -1,10 +1,11 @@
1
- from flask import Flask, render_template
2
  import gradio as gr
3
  from scraper import scrape_url
4
  from podcast_generator import PodcastGenerator
5
  from tts import text_to_speech
 
6
 
7
- app = Flask(__name__)
8
 
9
  def generate_podcast(url):
10
  content = scrape_url(url)
@@ -27,12 +28,13 @@ demo = gr.Interface(
27
  allow_flagging="never",
28
  )
29
 
30
- # Mount Gradio interface to Flask
31
  app = gr.mount_gradio_app(app, demo, path="/")
32
 
33
  if __name__ == "__main__":
34
- app.run(
 
35
  host="0.0.0.0",
36
  port=7860,
37
- debug=True
38
  )
 
1
+ from fastapi import FastAPI
2
  import gradio as gr
3
  from scraper import scrape_url
4
  from podcast_generator import PodcastGenerator
5
  from tts import text_to_speech
6
+ import uvicorn
7
 
8
+ app = FastAPI()
9
 
10
  def generate_podcast(url):
11
  content = scrape_url(url)
 
28
  allow_flagging="never",
29
  )
30
 
31
+ # Mount Gradio interface to FastAPI
32
  app = gr.mount_gradio_app(app, demo, path="/")
33
 
34
  if __name__ == "__main__":
35
+ uvicorn.run(
36
+ "app:app",
37
  host="0.0.0.0",
38
  port=7860,
39
+ reload=True
40
  )
requirements.txt CHANGED
@@ -1,9 +1,10 @@
1
  gradio==3.0.0
2
  browser-use
3
  elevenlabs==0.2.26
4
- flask==3.0.0
5
  pydub==0.25.1 # audio processing library
6
  python-dotenv==1.0.0 # for environment variables
7
  requests==2.31.0 # for API calls
8
  numpy>1.24.3 # common dependency
9
- openrouter
 
 
 
1
  gradio==3.0.0
2
  browser-use
3
  elevenlabs==0.2.26
 
4
  pydub==0.25.1 # audio processing library
5
  python-dotenv==1.0.0 # for environment variables
6
  requests==2.31.0 # for API calls
7
  numpy>1.24.3 # common dependency
8
+ openrouter
9
+ uvicorn
10
+ fastapi