Spaces:
Runtime error
Runtime error
acecalisto3
commited on
Commit
•
726b8a1
1
Parent(s):
dc59998
Update app.py
Browse files
app.py
CHANGED
@@ -35,7 +35,7 @@ from huggingface_hub import login
|
|
35 |
from transformers import AutoTokenizer, AutoModelForMaskedLM
|
36 |
|
37 |
tokenizer = AutoTokenizer.from_pretrained("sentence-transformers/all-mpnet-base-v2", clean_up_tokenization_spaces=True)
|
38 |
-
model = AutoModelForMaskedLM.from_pretrained("
|
39 |
|
40 |
# Define classifier for zero-shot classification
|
41 |
classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
|
@@ -64,7 +64,7 @@ logging.basicConfig(
|
|
64 |
)
|
65 |
|
66 |
# Define constants
|
67 |
-
DEFAULT_FILE_PATH = "
|
68 |
PURPOSE = (
|
69 |
"You go to Culvers sites, you continuously seek changes on them since your last observation. "
|
70 |
"Anything new that gets logged and dumped into csv, stored in your log folder at user/app/scraped_data."
|
@@ -1180,6 +1180,10 @@ def load_model():
|
|
1180 |
"text-generation",
|
1181 |
model=model,
|
1182 |
tokenizer=tokenizer,
|
|
|
|
|
|
|
|
|
1183 |
device=0 if torch.cuda.is_available() else -1,
|
1184 |
)
|
1185 |
logging.info("Model loaded successfully.")
|
@@ -1234,7 +1238,10 @@ def main():
|
|
1234 |
model = load_model()
|
1235 |
if model:
|
1236 |
logging.info("Application started successfully.")
|
|
|
|
|
1237 |
demo = create_interface()
|
|
|
1238 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
1239 |
else:
|
1240 |
logging.error("Failed to start the application.")
|
@@ -1246,7 +1253,7 @@ if __name__ == "__main__":
|
|
1246 |
|
1247 |
# Create and launch Gradio interface
|
1248 |
demo = create_interface()
|
1249 |
-
demo.launch(
|
1250 |
|
1251 |
-
|
1252 |
-
|
|
|
35 |
from transformers import AutoTokenizer, AutoModelForMaskedLM
|
36 |
|
37 |
tokenizer = AutoTokenizer.from_pretrained("sentence-transformers/all-mpnet-base-v2", clean_up_tokenization_spaces=True)
|
38 |
+
model = AutoModelForMaskedLM.from_pretrained("sentence-transformers/all-mpnet-base-v2")
|
39 |
|
40 |
# Define classifier for zero-shot classification
|
41 |
classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
|
|
|
64 |
)
|
65 |
|
66 |
# Define constants
|
67 |
+
DEFAULT_FILE_PATH = "scraped_data"
|
68 |
PURPOSE = (
|
69 |
"You go to Culvers sites, you continuously seek changes on them since your last observation. "
|
70 |
"Anything new that gets logged and dumped into csv, stored in your log folder at user/app/scraped_data."
|
|
|
1180 |
"text-generation",
|
1181 |
model=model,
|
1182 |
tokenizer=tokenizer,
|
1183 |
+
truncation=True,
|
1184 |
+
do_sample=True,
|
1185 |
+
temperature=0.7,
|
1186 |
+
top_p=0.95,
|
1187 |
device=0 if torch.cuda.is_available() else -1,
|
1188 |
)
|
1189 |
logging.info("Model loaded successfully.")
|
|
|
1238 |
model = load_model()
|
1239 |
if model:
|
1240 |
logging.info("Application started successfully.")
|
1241 |
+
print("Main function executed")
|
1242 |
+
print("Creating interface...")
|
1243 |
demo = create_interface()
|
1244 |
+
print("Launching interface...")
|
1245 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
1246 |
else:
|
1247 |
logging.error("Failed to start the application.")
|
|
|
1253 |
|
1254 |
# Create and launch Gradio interface
|
1255 |
demo = create_interface()
|
1256 |
+
demo.launch()
|
1257 |
|
1258 |
+
# Run automated tests
|
1259 |
+
unittest.main(argv=[''], exit=False)
|