DeriosMarcos commited on
Commit
fe6db3f
·
1 Parent(s): 6691bba

Added AI model integration

Browse files
Files changed (2) hide show
  1. app.py +25 -0
  2. requirements.txt +4 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Load your AI model
5
+ # Replace 'model_name' with the name of your chosen model from Hugging Face
6
+ model_name = "EleutherAI/gpt-neo-1.3B" # Example: GPT-Neo 1.3B
7
+ generator = pipeline('text-generation', model=model_name)
8
+
9
+ # Define a function to generate text
10
+ def generate_text(prompt):
11
+ # Generate text using the model
12
+ output = generator(prompt, max_length=50, num_return_sequences=1)
13
+ return output[0]['generated_text']
14
+
15
+ # Create a Gradio interface
16
+ iface = gr.Interface(
17
+ fn=generate_text, # Function to call
18
+ inputs="text", # Input type (text box)
19
+ outputs="text", # Output type (text box)
20
+ title="Text Generation with GPT-Neo", # Title of the interface
21
+ description="Enter a prompt and let the AI generate text for you!"
22
+ )
23
+
24
+ # Launch the interface
25
+ iface.launch()
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ gradio
2
+ openai
3
+ transformers
4
+ torch