Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ model_name = "Llama-2-7b-MOM_Summar.Q2_K.gguf"
|
|
15 |
# hf_hub_download(repo_id="sasvata/Llama2-7b-MOM-Summary-Finetuned-GGUF", filename=model_name, local_dir=model_path, local_dir_use_symlinks=False)
|
16 |
|
17 |
print("Start the model init process")
|
18 |
-
model =
|
19 |
print("Finish the model init process")
|
20 |
|
21 |
## Function to convert plain text to markdown format
|
@@ -41,19 +41,13 @@ def generate_prompt(
|
|
41 |
|
42 |
# Function to generate summary with the help of fine-tuned model
|
43 |
def Summary_Gen(Transcript):
|
44 |
-
print("Summary Gen Fucntion Start: ", Transcript)
|
45 |
prompt = generate_prompt(Transcript)
|
46 |
-
summary = model.generate(prompt=prompt,max_tokens=
|
47 |
-
# summary_output = to_markdown(summary)
|
48 |
-
print("Summary Gen Fucntion End: ", summary)
|
49 |
return summary
|
50 |
|
51 |
# Function for text summarization
|
52 |
def summarize_text(text):
|
53 |
-
print("Summarize Text Function Start: ", text)
|
54 |
-
# Your text summarization logic here (replaced with Summary_Gen)
|
55 |
summarized_text = Summary_Gen(text)
|
56 |
-
print("Summarize Text Function End: ", summarized_text)
|
57 |
return summarized_text
|
58 |
|
59 |
|
@@ -74,11 +68,10 @@ col1.title('Input')
|
|
74 |
col2.title('Output')
|
75 |
|
76 |
col1.container(height=500, border=True).text_area("", option, height=1000)
|
|
|
77 |
if col1.button("Summarize"):
|
78 |
with st.spinner('Wait for it...'):
|
79 |
-
#print("Summary Function Start", summary_output)
|
80 |
summary_output = summarize_text(option)
|
81 |
-
print("Summary Function End", summary_output)
|
82 |
col2.container(height=500, border=True).markdown(summary_output, unsafe_allow_html=True)
|
83 |
|
84 |
|
|
|
15 |
# hf_hub_download(repo_id="sasvata/Llama2-7b-MOM-Summary-Finetuned-GGUF", filename=model_name, local_dir=model_path, local_dir_use_symlinks=False)
|
16 |
|
17 |
print("Start the model init process")
|
18 |
+
model = GPT4All(model_name, model_path, allow_download = False, device="cpu")
|
19 |
print("Finish the model init process")
|
20 |
|
21 |
## Function to convert plain text to markdown format
|
|
|
41 |
|
42 |
# Function to generate summary with the help of fine-tuned model
|
43 |
def Summary_Gen(Transcript):
|
|
|
44 |
prompt = generate_prompt(Transcript)
|
45 |
+
summary = model.generate(prompt=prompt,max_tokens=1024)
|
|
|
|
|
46 |
return summary
|
47 |
|
48 |
# Function for text summarization
|
49 |
def summarize_text(text):
|
|
|
|
|
50 |
summarized_text = Summary_Gen(text)
|
|
|
51 |
return summarized_text
|
52 |
|
53 |
|
|
|
68 |
col2.title('Output')
|
69 |
|
70 |
col1.container(height=500, border=True).text_area("", option, height=1000)
|
71 |
+
col2.container(height=500, border=True).markdown("", unsafe_allow_html=True)
|
72 |
if col1.button("Summarize"):
|
73 |
with st.spinner('Wait for it...'):
|
|
|
74 |
summary_output = summarize_text(option)
|
|
|
75 |
col2.container(height=500, border=True).markdown(summary_output, unsafe_allow_html=True)
|
76 |
|
77 |
|