|
|
|
|
|
|
|
|
|
import gradio as gr |
|
from transformers import pipeline |
|
|
|
|
|
|
|
generator = pipeline('text-generation', model='NousResearch/Yarn-Mistral-7b-128k') |
|
|
|
def generate_code(prompt): |
|
|
|
responses = generator(prompt, max_length=500, num_return_sequences=1, temperature=0.1) |
|
return responses[0]['generated_text'] |
|
|
|
input_textbox = gr.Textbox(label="Please click any button below or enter the last 4 digits of your Amazon.in order-id, name and email along with your questions. We shall get back to you!", lines=3) |
|
outputs = gr.Markdown(label="Generated Code") |
|
title = "Schogini Toys - AI Chatbot V2.03" |
|
|
|
|
|
iface = gr.Interface( |
|
fn=generate_code, |
|
inputs=input_textbox, |
|
outputs=outputs, |
|
examples=[["Define a Python function to calculate factorial."]], |
|
title=title, |
|
) |
|
|
|
|
|
if __name__ == "__main__": |
|
iface.launch() |
|
|