test-app / app.py
lvkaokao's picture
Update app.py
49bcccd
raw
history blame contribute delete
No virus
749 Bytes
import gradio as gr
import uvicorn
# from fastapi import FastAPI, APIRouter
import requests
# router = APIRouter()
import json
# @router.get("/progress")
def check_progress():
resp = requests.get("http://3.88.103.173/finetuning/progress/1679038378_70")
print(resp.text)
return json.loads(resp.text)
def reverse(text):
return text[::-1]
with gr.Blocks() as demo:
button = gr.Button(value="Reverse")
button.click(reverse, gr.Textbox(), gr.Textbox())
# demo.app.include_router(router)
app, local_url, share_url = demo.launch(prevent_thread_lock=True)
print(app)
print(local_url)
print(share_url)
ret = app.add_api_route("/progress", check_progress, methods=["GET"])
print(ret)
uvicorn.run(app, host="0.0.0.0", port=7861)