Update main.py
Browse files
main.py
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
from fastapi import FastAPI, HTTPException, Request
|
2 |
import requests
|
|
|
3 |
|
4 |
app = FastAPI()
|
5 |
|
6 |
-
API_URL = "https://
|
7 |
|
8 |
def generate_text(prompt):
|
9 |
params = {
|
@@ -24,12 +24,9 @@ def generate_text(prompt):
|
|
24 |
@app.get('/')
|
25 |
def welcome():
|
26 |
return "Welcome dude"
|
27 |
-
|
28 |
-
|
29 |
@app.get('/generate-response')
|
30 |
-
async def generate_response(
|
31 |
-
data = await request.json()
|
32 |
-
prompt = data.get('prompt')
|
33 |
if not prompt:
|
34 |
raise HTTPException(status_code=400, detail="Prompt is missing")
|
35 |
|
|
|
|
|
1 |
import requests
|
2 |
+
from fastapi import FastAPI, HTTPException, Query
|
3 |
|
4 |
app = FastAPI()
|
5 |
|
6 |
+
API_URL = "https://huggingface.co/spaces/Gemechis/noname/generate-response"
|
7 |
|
8 |
def generate_text(prompt):
|
9 |
params = {
|
|
|
24 |
@app.get('/')
|
25 |
def welcome():
|
26 |
return "Welcome dude"
|
27 |
+
|
|
|
28 |
@app.get('/generate-response')
|
29 |
+
async def generate_response(prompt: str = Query(..., description="The prompt for text generation")):
|
|
|
|
|
30 |
if not prompt:
|
31 |
raise HTTPException(status_code=400, detail="Prompt is missing")
|
32 |
|