News-Summarizer / app.py
swap1411's picture
Update app.py
59c8265 verified
raw
history blame contribute delete
841 Bytes
import gradio as gr
from utils import generate_report
from fastapi import FastAPI
import uvicorn
app = FastAPI()
@app.get("/report")
async def get_report(company: str):
report, audio_file = generate_report(company)
if "error" in report:
raise HTTPException(status_code=404, detail=report["error"])
return {"report": report, "audio": audio_file}
iface = gr.Interface(
fn=lambda company: generate_report(company),
inputs=gr.Textbox(label="कंपनी का नाम दर्ज करें (Enter the name of the company)"),
outputs=[gr.JSON(), gr.Audio()]
)
# Hugging Face Spaces requires this block
if __name__ == "__main__":
#uvicorn.run(app, host="0.0.0.0", port=8000) # Use 0.0.0.0 for external access
iface.launch(server_name="0.0.0.0", server_port=7860) # Gradio's default port