tinchex37 commited on
Commit
b3ce780
verified
1 Parent(s): 08048bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -1
app.py CHANGED
@@ -1,9 +1,33 @@
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
- pipe = pipeline('sentiment-analysis')
5
  text = st.text_area('enter text: ')
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  if text:
8
  out = pipe(text)
9
  st.json(out)
 
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
+ # pipe = pipeline('sentiment-analysis')
5
  text = st.text_area('enter text: ')
6
 
7
+ generator = pipeline("text-generation", model="EleutherAI/gpt-neo-2.7B")
8
+
9
+
10
+ technical_text = """
11
+ The CRISPR-Cas9 system enables precise genome editing by creating double-strand breaks at specific DNA locations, facilitating targeted genetic modifications.
12
+ """
13
+
14
+ # Prompt para transformaci贸n
15
+ prompt = f"Rewrite the following technical text in simple terms for a general audience:\n\n{text}\n\nSimplified version:"
16
+
17
+ # Generar texto transformado
18
+ result = generator(
19
+ prompt,
20
+ max_length=256,
21
+ num_return_sequences=1,
22
+ do_sample=True,
23
+ temperature=0,
24
+ top_p=0.9,
25
+ repetition_penalty=1.1,
26
+ )
27
+
28
+ print(result[0]['generated_text'])
29
+
30
+
31
  if text:
32
  out = pipe(text)
33
  st.json(out)