CoolFace
Apppublic

tkrishnan15/RevisionBot

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
app.py47 linesDownload Raw Back to root
1import os2import gradio as gr3from groq import Groq4 5 6 7 8 9def chat_response(prompt, history):10 11    client = Groq(12    api_key=os.environ.get("GROQ_API_KEY")13)14 15    chat_completion = client.chat.completions.create(16    messages=[17 18        {19            "role": "system",20            "content": "You are a revision assistant bot. Summarize the study topic/ material and then you answer any follow up questions on the content in a simple and easy to understand way. Be crisp and precise in your answers",21        }22        ,23        24        {25            "role": "user",26            "content": f"With chat history: {history},{prompt}",27        }28    ],29    model="llama3-8b-8192",30)31    32    return chat_completion.choices[0].message.content33 34 35 36 37 38demo = gr.ChatInterface(39    fn = chat_response,40    title="Revision Bot",41    examples = ["Teach me about world war"]42 43)44 45 46if __name__ == "__main__":47    demo.launch()