Spaces:
Sleeping
Sleeping
import os | |
from groq import Groq | |
import gradio as gr | |
client = Groq( | |
api_key =os.getenv('api_key_gorq') | |
) | |
def response_from_llam3(query): | |
messages = [ | |
{ | |
"role" : "system", | |
"content": "You are an helpul Assistant who has plently of Knowledge on Ayur Veda. If the message is Hi or any greeting say namste how can i assist you " | |
}, | |
{ | |
"role": "user", | |
"content": "What is the answer to {}".format(query) | |
} | |
] | |
response = client.chat.completions.create( | |
messages = messages, | |
model = "llama3-70b-8192" | |
) | |
return response.choices[0].message.content | |
gr.Markdown("<h1>π Ayurveda Mate π¦</h1>") | |
gr.Markdown("<h3> πΉοΈ Type your questions or prompts below and see how each model responds to the same input πΎ </h3>") | |
iface = gr.Interface( | |
fn=response_from_llam3, | |
inputs="text", | |
outputs="text", | |
examples=[ | |
['What is importance of fasting according to Ayurveda?'], | |
['What are the medicinal values of Tusli?'], | |
['What are the three different doshas?'], | |
['What is the ideal diet according to ayurveda?'] | |
], | |
cache_examples=False, | |
) | |
iface.launch() | |
# with gr.Blocks() as demo: | |
# gr.Markdown("<h1>π Ayurveda Mate π¦</h1>") | |
# gr.Markdown("<h3> πΉοΈ Type your questions or prompts below and see how each model responds to the same input πΎ </h3>") | |
# with gr.Row(): | |
# input_text = gr.Textbox(label="Enter your prompt here:", placeholder="Type something...", lines=2) | |
# submit_button = gr.Button("Submit") | |
# output_llama = gr.Textbox(label="Llama 3 8B πΎ", placeholder="", lines=10, interactive=False) | |
# # output_mistral = gr.Textbox(label="Mistral 7B π ", placeholder="", lines=10, interactive=False) | |
# submit_button.click(fn=response_from_llam3, inputs="text", outputs="text") | |
# if __name__ == "__main__": | |
# demo.launch() |