bart-cls / main.py
astro21's picture
Update main.py
59d9679
raw
history blame
556 Bytes
from fastapi import FastAPI
from gradio_client import Client
app = FastAPI()
# Define a route for the prediction using FastAPI
@app.post("/predict")
async def predict(text: str):
# Replace this URL with the actual API endpoint URL
api_endpoint_url = "https://astro21-test-2.hf.space/--replicas/x5m8s/"
# Use the Gradio client to make the prediction request
client = Client(api_endpoint_url)
result = client.predict(
text,
api_name="/predict"
)
# Return the result as a response
return {"result": result}