Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,29 @@
|
|
1 |
import streamlit as st
|
|
|
|
|
|
|
|
|
2 |
|
3 |
st.title("Hello World App")
|
4 |
name = st.text_input("Enter your name:")
|
5 |
if st.button("Greet"):
|
6 |
-
st.write(f"Hello, {name}!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
import uvicorn
|
3 |
+
|
4 |
+
from fastapi import FastAPI, Depends, HTTPException, status, Request
|
5 |
+
from fastapi.responses import StreamingResponse
|
6 |
|
7 |
st.title("Hello World App")
|
8 |
name = st.text_input("Enter your name:")
|
9 |
if st.button("Greet"):
|
10 |
+
st.write(f"Hello, {name}!")
|
11 |
+
|
12 |
+
app = FastAPI()
|
13 |
+
|
14 |
+
|
15 |
+
@app.get("/")
|
16 |
+
async def root():
|
17 |
+
return {"message": "Welcome to FastAPI!"}
|
18 |
+
|
19 |
+
|
20 |
+
@app.post("/generate")
|
21 |
+
async def generate(query: str):
|
22 |
+
# stream_response = run_generation(query)
|
23 |
+
stream_response = "Hi i am"
|
24 |
+
return StreamingResponse(stream_response, media_type="text/plain")
|
25 |
+
|
26 |
+
|
27 |
+
if __name__ == "__main__":
|
28 |
+
uvicorn.run(app, host="0.0.0.0", port=8080, log_level="debug")
|
29 |
+
|