Update app.py
Browse files
app.py
CHANGED
|
@@ -101,15 +101,6 @@ def main(urls):
|
|
| 101 |
@spaces.GPU()
|
| 102 |
def classify_website(url):
|
| 103 |
global model, tokenizer # Declare model and tokenizer as global variables
|
| 104 |
-
|
| 105 |
-
urls = [url]
|
| 106 |
-
results_shop = main(urls)
|
| 107 |
-
|
| 108 |
-
# Convert results to DataFrame
|
| 109 |
-
df_result_train_more = pd.DataFrame(results_shop)
|
| 110 |
-
text = df_result_train_more['text'][0]
|
| 111 |
-
translated = GoogleTranslator(source='auto', target='en').translate(text[:4990])
|
| 112 |
-
|
| 113 |
|
| 114 |
try:
|
| 115 |
# Load the model and tokenizer if they are not already loaded
|
|
@@ -125,6 +116,16 @@ def classify_website(url):
|
|
| 125 |
)
|
| 126 |
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
|
| 127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
prompt = f"""Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
|
| 129 |
|
| 130 |
### Instruction:
|
|
|
|
| 101 |
@spaces.GPU()
|
| 102 |
def classify_website(url):
|
| 103 |
global model, tokenizer # Declare model and tokenizer as global variables
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
try:
|
| 106 |
# Load the model and tokenizer if they are not already loaded
|
|
|
|
| 116 |
)
|
| 117 |
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
|
| 118 |
|
| 119 |
+
|
| 120 |
+
urls = [url]
|
| 121 |
+
results_shop = main(urls)
|
| 122 |
+
|
| 123 |
+
# Convert results to DataFrame
|
| 124 |
+
df_result_train_more = pd.DataFrame(results_shop)
|
| 125 |
+
text = df_result_train_more['text'][0]
|
| 126 |
+
translated = GoogleTranslator(source='auto', target='en').translate(text[:4990])
|
| 127 |
+
|
| 128 |
+
|
| 129 |
prompt = f"""Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
|
| 130 |
|
| 131 |
### Instruction:
|