SilvusTV commited on
Commit
ed350f1
1 Parent(s): 64a6ef4

update app and image.

Browse files
Files changed (3) hide show
  1. app.py +6 -1
  2. image.py +3 -3
  3. language.py +9 -0
app.py CHANGED
@@ -1,13 +1,18 @@
1
  from image import *
2
  import streamlit as st
 
3
 
4
  # url = "https://i.imgur.com/qs0CxjE_d.webp?maxwidth=760&fidelity=grand"
5
  # text = "What is the two color's car ?"
6
 
7
- st.write('Application starting...')
8
 
9
  text = st.text_input('Posez votre question (en anglais)')
10
  url = st.text_input('mettez le liens de votre image')
11
 
12
  if st.button('générer'):
13
  st.write('response is :', image(url, text))
 
 
 
 
 
1
  from image import *
2
  import streamlit as st
3
+ import os
4
 
5
  # url = "https://i.imgur.com/qs0CxjE_d.webp?maxwidth=760&fidelity=grand"
6
  # text = "What is the two color's car ?"
7
 
8
+ st.write('Part 1')
9
 
10
  text = st.text_input('Posez votre question (en anglais)')
11
  url = st.text_input('mettez le liens de votre image')
12
 
13
  if st.button('générer'):
14
  st.write('response is :', image(url, text))
15
+
16
+ st.write('Part 2')
17
+
18
+ os.system("language.py")
image.py CHANGED
@@ -15,9 +15,9 @@ def image(url, text):
15
  outputs = model(**encoding)
16
  logits = outputs.logits
17
  idx = logits.argmax(-1).item()
18
- print("question asked:", text)
19
- print("image link:", url)
20
- print("Predicted answer:", model.config.id2label[idx])
21
 
22
  return model.config.id2label[idx]
23
 
 
15
  outputs = model(**encoding)
16
  logits = outputs.logits
17
  idx = logits.argmax(-1).item()
18
+ # print("question asked:", text)
19
+ # print("image link:", url)
20
+ # print("Predicted answer:", model.config.id2label[idx])
21
 
22
  return model.config.id2label[idx]
23
 
language.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+
3
+ input = "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 in french"
7
+
8
+ generator = pipeline('text-generation', model='gpt2')
9
+ print(generator(input, max_length=30))