AeternumS commited on
Commit
315b363
1 Parent(s): d8ecef0

remove print

Browse files
Files changed (1) hide show
  1. app.py +16 -8
app.py CHANGED
@@ -31,8 +31,16 @@ st.title("API Query App")
31
  st.write("This app allows you to query the API and retrieve responses.")
32
 
33
  user_input = """
34
- You will be given a text containing some parameters I want you to extract in json format.
35
- Here are all the paramters:
 
 
 
 
 
 
 
 
36
 
37
  """
38
 
@@ -45,12 +53,12 @@ if st.button("Submit"):
45
  with st.spinner("Extracting text from image..."):
46
  # Extract text from the uploaded image
47
  extracted_text = extract_text_from_image(uploaded_image)
48
- st.write("Extracted text from image:")
49
- st.write(extracted_text)
50
-
51
  with st.spinner("Fetching response from API..."):
52
  # Query the API with user input
53
- input = user_input + " :"
54
- output = query({"inputs": user_input, "parameters": {}})
55
  st.success("Response received!")
56
- st.write(output[0]["generated_text"]) # Display the response
 
 
31
  st.write("This app allows you to query the API and retrieve responses.")
32
 
33
  user_input = """
34
+ Extrais les paramètres suivants dans un json:
35
+
36
+ - Date de naissance
37
+ - Prénom
38
+ - Nom du patient
39
+
40
+ Dans ta réponse, le json (uniquement) doit apparaitre entre <JSON> et </JSON>.
41
+ Ne répond que par le json entre les balises, si les paramètres n'existent pas, laisse les champs vides.
42
+
43
+ Voici le texte qui contient les paramètres à extraire:
44
 
45
  """
46
 
 
53
  with st.spinner("Extracting text from image..."):
54
  # Extract text from the uploaded image
55
  extracted_text = extract_text_from_image(uploaded_image)
56
+ st.write("Extracted text from image.")
57
+
 
58
  with st.spinner("Fetching response from API..."):
59
  # Query the API with user input
60
+ llm_input = user_input + extracted_text + "\n Donne uniquement le json entre balises, pas le texte:"
61
+ output = query({"inputs": llm_input, "parameters": {}})
62
  st.success("Response received!")
63
+ st.write(output) # Display the response
64
+