File size: 749 Bytes
c18ee7e 49bcccd c18ee7e |
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 |
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) |