Spaces:
Runtime error
Runtime error
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") | |
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") |