File size: 772 Bytes
5c3eb22 feffd77 5c3eb22 feffd77 5c3eb22 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
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__":
# Start ngrok when the app is run
ngrok_tunnel = ngrok.connect(5000)
print("Public URL:", ngrok_tunnel.public_url)
# Start Flask in a separate thread
flask_thread = threading.Thread(target=run_flask)
flask_thread.start()
# Keep the main thread alive
try:
input("Press Enter to quit...\n")
finally:
# Stop ngrok and Flask
ngrok.kill()
flask_thread.join()
|