Spaces:
Sleeping
Sleeping
| from fastapi import FastAPI, HTTPException | |
| from fastapi.responses import HTMLResponse | |
| import matplotlib.pyplot as plt | |
| from io import BytesIO | |
| import base64 | |
| from gradio_client import Client | |
| app = FastAPI() | |
| async def predict( | |
| name1: str, score1: int, | |
| name2: str, score2: int, | |
| name3: str, score3: int, | |
| name4: str, score4: int, | |
| name5: str, score5: int | |
| ): | |
| # Create a Gradio client and make a prediction | |
| gradio_client = Client("https://deepak6593-gradio-app.hf.space/--replicas/9890g/") | |
| result = gradio_client.predict( | |
| name1, score1, name2, score2, name3, score3, name4, score4, name5, score5, | |
| api_name="/predict" | |
| ) | |
| # HTML response containing the iframe | |
| iframe_html = f'<iframe src="{result['plot']}" width="600" height="400"></iframe>' | |
| return HTMLResponse(content=iframe_html) | |