|
from flask import Flask |
|
import gradio as gr |
|
import threading |
|
from pyngrok import ngrok |
|
|
|
app = Flask(__name__) |
|
|
|
@app.route("/") |
|
def gradio_app(): |
|
gr.load("models/Salama1429/tarteel-ai-whisper-base-ar-quran").launch(share=True) |
|
return "Gradio app launched" |
|
|
|
def run_flask(): |
|
app.run(host='0.0.0.0', port=5000) |
|
|
|
if __name__ == "__main__": |
|
|
|
ngrok_tunnel = ngrok.connect(5000) |
|
print("Public URL:", ngrok_tunnel.public_url) |
|
|
|
|
|
flask_thread = threading.Thread(target=run_flask) |
|
flask_thread.start() |
|
|
|
|
|
try: |
|
input("Press Enter to quit...\n") |
|
finally: |
|
|
|
ngrok.kill() |
|
flask_thread.join() |
|
|