lvkaokao commited on
Commit
c18ee7e
1 Parent(s): 6b5205c

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -0
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import uvicorn
3
+ # from fastapi import FastAPI, APIRouter
4
+ import requests
5
+ # router = APIRouter()
6
+ import json
7
+
8
+
9
+ # @router.get("/progress")
10
+ def check_progress():
11
+ resp = requests.get("http://3.88.103.173/finetuning/progress/1679038378_70")
12
+ print(resp.text)
13
+ return json.loads(resp.text)
14
+
15
+ def reverse(text):
16
+ return text[::-1]
17
+
18
+ with gr.Blocks() as demo:
19
+ button = gr.Button(value="Reverse")
20
+ button.click(reverse, gr.Textbox(), gr.Textbox())
21
+
22
+ # demo.app.include_router(router)
23
+
24
+ app, local_url, share_url = demo.launch(share=True, prevent_thread_lock=True)
25
+ print(app)
26
+ print(local_url)
27
+ print(share_url)
28
+ ret = app.add_api_route("/progress", check_progress, methods=["GET"])
29
+ print(ret)
30
+
31
+
32
+ uvicorn.run(app, host="0.0.0.0", port=7861)