Update app.py
Browse files
app.py
CHANGED
@@ -54,4 +54,21 @@ def main():
|
|
54 |
for line in block.lines:
|
55 |
for word in line.words:
|
56 |
text += word.value + " "
|
57 |
-
text += "\n
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
for line in block.lines:
|
55 |
for word in line.words:
|
56 |
text += word.value + " "
|
57 |
+
text += "\n"
|
58 |
+
|
59 |
+
# Prepare the input for the LLM
|
60 |
+
messages = [
|
61 |
+
{"role": "system", "content": "You are a helpful AI assistant."},
|
62 |
+
{"role": "user", "content": f"Extract the email, phone number, and location from the following text:\n{text}"}
|
63 |
+
]
|
64 |
+
|
65 |
+
# Use the LLM to extract the details
|
66 |
+
output = pipe(messages, **generation_args)
|
67 |
+
generated_text = output[0]['generated_text']
|
68 |
+
|
69 |
+
# Display the extracted information
|
70 |
+
st.header('Extracted Information')
|
71 |
+
st.write(generated_text)
|
72 |
+
|
73 |
+
if __name__ == '__main__':
|
74 |
+
main()
|