Commit
·
c3340ef
1
Parent(s):
5754774
Sree
Browse files- app.py +30 -1
- push.sh +8 -0
- requirements.txt +6 -0
app.py
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
# import gradio as gr
|
| 2 |
+
|
| 3 |
+
# gr.Interface.load("models/NousResearch/Yarn-Mistral-7b-128k").launch()
|
| 4 |
+
|
| 5 |
import gradio as gr
|
| 6 |
+
from transformers import pipeline
|
| 7 |
+
|
| 8 |
+
# Load a small GPT model fine-tuned for Python code generation
|
| 9 |
+
# generator = pipeline('text-generation', model='microsoft/CodeGPT-small-py')
|
| 10 |
+
generator = pipeline('text-generation', model='NousResearch/Yarn-Mistral-7b-128k')
|
| 11 |
+
|
| 12 |
+
def generate_code(prompt):
|
| 13 |
+
# Generate code from the model
|
| 14 |
+
responses = generator(prompt, max_length=500, num_return_sequences=1, temperature=0.1)
|
| 15 |
+
return responses[0]['generated_text']
|
| 16 |
+
|
| 17 |
+
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)
|
| 18 |
+
outputs = gr.Markdown(label="Generated Code")
|
| 19 |
+
title = "Schogini Toys - AI Chatbot V2.03"
|
| 20 |
+
|
| 21 |
+
# Create a Gradio Interface
|
| 22 |
+
iface = gr.Interface(
|
| 23 |
+
fn=generate_code,
|
| 24 |
+
inputs=input_textbox, #[gr.Textbox(lines=10, label="Type your code description here")],
|
| 25 |
+
outputs=outputs, #[gr.Textbox(label="Generated Code")],
|
| 26 |
+
examples=[["Define a Python function to calculate factorial."]],
|
| 27 |
+
title=title,
|
| 28 |
+
)
|
| 29 |
|
| 30 |
+
# Run the interface
|
| 31 |
+
if __name__ == "__main__":
|
| 32 |
+
iface.launch()
|
push.sh
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
#pip install --upgrade huggingface_hub
|
| 3 |
+
|
| 4 |
+
git add .
|
| 5 |
+
git commit -m Sree
|
| 6 |
+
git push
|
| 7 |
+
|
| 8 |
+
echo https://schogini-test1.hf.space
|
requirements.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
#==3.1.4
|
| 3 |
+
transformers
|
| 4 |
+
#==4.20.1
|
| 5 |
+
#huggingface_hub==0.19.0
|
| 6 |
+
torch
|