ftx7go commited on
Commit
1338706
·
verified ·
1 Parent(s): e59ed48

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -1,18 +1,18 @@
1
- from flask import Flask, send_file
2
  import gradio as gr
 
3
 
4
  app = Flask(__name__)
5
 
6
- # Route to serve HTML file
7
  @app.route("/")
8
- def serve_html():
9
- return send_file("re.html")
10
 
11
- # Run Gradio separately
12
  def run_gradio():
13
  gr.Interface(lambda: "Gradio App Running!", inputs=[], outputs="text").launch(share=True)
14
 
15
  if __name__ == "__main__":
16
- from threading import Thread
17
- Thread(target=run_gradio).start()
18
- app.run(host="0.0.0.0", port=7860)
 
1
+ from flask import Flask, render_template
2
  import gradio as gr
3
+ import threading
4
 
5
  app = Flask(__name__)
6
 
7
+ # Route to serve HTML page
8
  @app.route("/")
9
+ def home():
10
+ return render_template("re.html") # Flask will load from templates folder
11
 
12
+ # Function to run Gradio separately
13
  def run_gradio():
14
  gr.Interface(lambda: "Gradio App Running!", inputs=[], outputs="text").launch(share=True)
15
 
16
  if __name__ == "__main__":
17
+ threading.Thread(target=run_gradio).start()
18
+ app.run(host="0.0.0.0", port=5000, debug=True) # Change port if needed