SilvusTV commited on
Commit
78be242
1 Parent(s): f6b625e

update language function

Browse files
Files changed (2) hide show
  1. app.py +3 -3
  2. language.py +2 -13
app.py CHANGED
@@ -9,13 +9,13 @@ import os
9
 
10
  st.write('Part 1')
11
 
12
- text = st.text_input('Posez votre question (en anglais)')
13
  url = st.text_input('mettez le liens de votre image')
14
 
15
  if st.button('générer'):
16
- responseBase = image(url, text)
17
  st.write('response is :', responseBase)
18
  st.write('Part 2')
19
- st.write(longText(responseBase))
20
 
21
  print('#### TEST 2####')
 
9
 
10
  st.write('Part 1')
11
 
12
+ question = st.text_input('Posez votre question (en anglais)')
13
  url = st.text_input('mettez le liens de votre image')
14
 
15
  if st.button('générer'):
16
+ responseBase = image(url, question)
17
  st.write('response is :', responseBase)
18
  st.write('Part 2')
19
+ st.write(longText(responseBase, question))
20
 
21
  print('#### TEST 2####')
language.py CHANGED
@@ -1,21 +1,10 @@
1
  print('###### LANGUAGES ######')
2
-
3
- input_text = "i have question and answere.\
4
- the question is : How many cars here ?\
5
- the response is : 2\
6
- with this information, can you crate an answere phrase"
7
-
8
  from transformers import T5Tokenizer, T5ForConditionalGeneration
9
 
10
- tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-large")
11
- model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-large")
12
-
13
- input_ids = tokenizer(input_text, return_tensors="pt").input_ids
14
 
15
- outputs = model.generate(input_ids)
16
- print(tokenizer.decode(outputs[0]))
17
 
18
- def longText(input_text):
19
  tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-large")
20
  model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-large")
21
  input_ids = tokenizer(input_text, return_tensors="pt").input_ids
 
1
  print('###### LANGUAGES ######')
 
 
 
 
 
 
2
  from transformers import T5Tokenizer, T5ForConditionalGeneration
3
 
4
+ def longText(answere, question):
 
 
 
5
 
6
+ input_text = "i have a question and answer.\nthe question is :",question,"\n the response is :",answere,"\n with this information, can you create an answer phrase?"
 
7
 
 
8
  tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-large")
9
  model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-large")
10
  input_ids = tokenizer(input_text, return_tensors="pt").input_ids