Spaces:
Runtime error
Runtime error
File size: 1,101 Bytes
f19e9c2 a5c729e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
from fastapi import FastAPI, Request, Form, UploadFile, File
from fastapi.responses import HTMLResponse, RedirectResponse
from fastapi.staticfiles import StaticFiles
from fastapi.templating import Jinja2Templates
from typing import Annotated
import gradio as gr
from src.grutils import answer_query, css
app = FastAPI()
app.mount("/static", StaticFiles(directory="static"), name="static")
templates = Jinja2Templates(directory="templates")
@app.get("/")
async def root():
return {"message": "Hello to the world of Mohammed Vasim"}
####### Gradio app ##############
chatbot = gr.Chatbot(label="Llama 2")
with gr.Blocks(
title="Llama 2",
theme=gr.themes.Soft(),
css=css
) as llama2bot:
gr.Markdown("# <center> Welcome to llama 2 Web App</center>")
gr.ChatInterface(fn=answer_query, chatbot=chatbot, submit_btn="Ask", undo_btn=None, retry_btn=None, clear_btn=None)
gr.Markdown("<center> Developed by Mohammed Vasim | AI Engineer @ ChatGPT Warriors. </center>")
# mounting at the path
app = gr.mount_gradio_app(app, llama2bot, path="/llama2") |