Skip to content

Commit 82f2e3f

Browse files
committed
Sync with server
1 parent 3ee6626 commit 82f2e3f

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

app.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ def config():
126126

127127
def call_gpt(paragraph, trigger):
128128
# openai.api_key = os.environ.get("GPT-API")
129-
openai.api_key = ""
130129
tokenizer = BartTokenizer.from_pretrained("theQuert/NetKUp-tokenzier")
131130
inputs_for_gpt = f"""
132131
s an article writer, your task is to provide an updated paragraph in the length same as non-updated paragraph based on the given non-updated paragraph and a triggered news.Remember, the length of updated paragraph is restricted into a single paragraph.
@@ -160,13 +159,13 @@ def call_vicuna(paragraphs_tirgger):
160159
{trigger}
161160
"""
162161
merged_with_prompts.append(merged.strip())
163-
pd.DataFrame({"paragraph": merged_with_prompts}).to_csv("./experiments/paragraphs_with_prompts.csv")
162+
pd.DataFrame({"paragraph": merged_with_prompts}).to_csv("./util/experiments/paragraphs_with_prompts.csv")
164163
responses = vicuna_output()
165164
return responses
166165

167166

168167
def main(input_article, input_trigger):
169-
paths = [".util/experiments/input_paragraphs.csv",
168+
paths = [".util/experiments/input_paragraphs.csv",
170169
"./util/experiments/formatted_input.txt",
171170
"./util/experiments/updated_article.txt",
172171
"./util/experiments/paragraphs_needed.txt",
@@ -275,23 +274,23 @@ def main(input_article, input_trigger):
275274
# paragarphs_merged = ["".join(par.split(" -- ")[:-1]) for par in paragraphs_merged]
276275
updated_article = str(sep.join(paragraphs_merged))
277276
updated_article = updated_article.replace("[{'summary_text': '", "").replace("'}]", "").strip()
278-
class_res = pd.read_csv("./experiments/classification.csv")
277+
class_res = pd.read_csv("./util/experiments/classification.csv")
279278
if class_res.target.values.all() == 0: modified="False"
280279

281280
if len(data_test)==1:
282281
modified="TRUE"
283282
updated_article = call_gpt(input_article, input_trigger)
284-
with open("./experiments/updated_article.txt", "w") as f:
283+
with open("./util/experiments/updated_article.txt", "w") as f:
285284
f.write(updated_article)
286285

287286
# combine the predictions and paragraphs into csv format file
288-
merged_par_pred_df = pd.DataFrame({"paragraphs": data_test, "predictions": predictions}).to_csv("./experiments/par_with_class.csv")
287+
merged_par_pred_df = pd.DataFrame({"paragraphs": data_test, "predictions": predictions}).to_csv("./util/experiments/par_with_class.csv")
289288
# return updated_article, modified, merged_par_pred_df
290289
modified_in_all = str(len(paragraphs_needed)) + " / " + str(len(data_test))
291290
return updated_article, modified_in_all
292291

293292
def copy_to_clipboard(t):
294-
with open("./experiments/updated_article.txt", "r") as f:
293+
with open("./util/experiments/updated_article.txt", "r") as f:
295294
t = f.read()
296295
pyperclip.copy(t)
297296

@@ -369,5 +368,5 @@ def compare_versions():
369368
"""
370369
)
371370

372-
demo.launch()
371+
demo.launch(server_name="0.0.0.0", server_port=7840)
373372

util/experiments/test_file

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test

0 commit comments

Comments
 (0)