rioanggara commited on
Commit
b2b054d
·
1 Parent(s): 5f3bbeb

make it work please

Browse files
Files changed (2) hide show
  1. app.py +5 -3
  2. requirements.txt +1 -4
app.py CHANGED
@@ -2,9 +2,11 @@ import gradio as gr
2
  import matplotlib.pyplot as plt
3
  from transformers import pipeline
4
 
5
- # Load the Hugging Face pipelines for translation and text generation
6
  translator = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es")
7
- generator = pipeline("text-generation", model="gpt3.5-turbo")
 
 
8
 
9
  # Define the function to generate the graph based on the translated prompt
10
  def generate_graph(prompt):
@@ -12,7 +14,7 @@ def generate_graph(prompt):
12
  translated_prompt = translator(prompt, max_length=100, src_lang="en", tgt_lang="es")
13
  translated_text = translated_prompt[0]['translation_text']
14
 
15
- # Generate text using the Hugging Face pipeline
16
  response = generator(translated_text, max_length=100)
17
  text = response[0]['generated_text']
18
 
 
2
  import matplotlib.pyplot as plt
3
  from transformers import pipeline
4
 
5
+ # Load the Hugging Face pipeline for translation
6
  translator = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es")
7
+
8
+ # Load the Hugging Face pipeline for text generation using GPT-J
9
+ generator = pipeline("text-generation", model="EleutherAI/gpt-j-6B")
10
 
11
  # Define the function to generate the graph based on the translated prompt
12
  def generate_graph(prompt):
 
14
  translated_prompt = translator(prompt, max_length=100, src_lang="en", tgt_lang="es")
15
  translated_text = translated_prompt[0]['translation_text']
16
 
17
+ # Generate text using the Hugging Face pipeline with GPT-J
18
  response = generator(translated_text, max_length=100)
19
  text = response[0]['generated_text']
20
 
requirements.txt CHANGED
@@ -1,6 +1,3 @@
1
  gradio
2
  matplotlib
3
- transformers
4
- sentencepiece
5
- torch
6
- tensorflow
 
1
  gradio
2
  matplotlib
3
+ transformers