Spaces:
Sleeping
Sleeping
Commit
·
fe84c5e
1
Parent(s):
c95667e
adding app
Browse files
app.py
CHANGED
@@ -71,16 +71,17 @@ def summarize_data(docs,llm_model,chain_type='refine'):
|
|
71 |
output_key="output_text",
|
72 |
)
|
73 |
summary = chain({"input_documents": docs}, return_only_outputs=True)
|
74 |
-
output_text = summary["output_text"].
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
|
|
|
|
82 |
|
83 |
-
return " ".join(lines)
|
84 |
|
85 |
|
86 |
def process_documents(texts,data_chunk=1000,chunk_overlap=10):
|
@@ -134,7 +135,7 @@ iface = gr.Interface(
|
|
134 |
"file"
|
135 |
],
|
136 |
outputs="text",
|
137 |
-
description ="Summarize your PDF Document having Image
|
138 |
)
|
139 |
|
140 |
iface.launch()
|
|
|
71 |
output_key="output_text",
|
72 |
)
|
73 |
summary = chain({"input_documents": docs}, return_only_outputs=True)
|
74 |
+
output_text = summary["output_text"].replace('\n','')
|
75 |
+
|
76 |
+
consice_sumary = re.search("CONCISE SUMMARY:.*\.*$", text).group(0)
|
77 |
+
dash_id = consice_sumary.find('-')
|
78 |
+
return consice_sumary[:dash_id]
|
79 |
+
# matches = re.finditer(regex, output_text, re.DOTALL)
|
80 |
+
# for matchNum, match in enumerate(matches, start=1):
|
81 |
+
# for groupNum in range(0, len(match.groups())):
|
82 |
+
# groupNum = groupNum + 1
|
83 |
+
# lines = match.group(groupNum).strip().split("\n")
|
84 |
|
|
|
85 |
|
86 |
|
87 |
def process_documents(texts,data_chunk=1000,chunk_overlap=10):
|
|
|
135 |
"file"
|
136 |
],
|
137 |
outputs="text",
|
138 |
+
description ="Summarize your PDF Document having Image • HuggingFace",
|
139 |
)
|
140 |
|
141 |
iface.launch()
|