Update app.py
Browse files
app.py
CHANGED
|
@@ -12,6 +12,7 @@ from indic_transliteration import sanscript
|
|
| 12 |
from indic_transliteration.sanscript import transliterate
|
| 13 |
import openai
|
| 14 |
import torch
|
|
|
|
| 15 |
|
| 16 |
# Detect if GPU is available
|
| 17 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
|
@@ -44,7 +45,9 @@ if text_generation_tokenizer.pad_token is None:
|
|
| 44 |
API_URL = "https://api-inference.huggingface.co/models/CompVis/stable-diffusion-v1-4"
|
| 45 |
|
| 46 |
# Load the trained sentiment analysis model and preprocessing steps
|
| 47 |
-
|
|
|
|
|
|
|
| 48 |
|
| 49 |
# Function to query Hugging Face API
|
| 50 |
def query(payload, max_retries=5):
|
|
|
|
| 12 |
from indic_transliteration.sanscript import transliterate
|
| 13 |
import openai
|
| 14 |
import torch
|
| 15 |
+
import warnings
|
| 16 |
|
| 17 |
# Detect if GPU is available
|
| 18 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
|
|
|
| 45 |
API_URL = "https://api-inference.huggingface.co/models/CompVis/stable-diffusion-v1-4"
|
| 46 |
|
| 47 |
# Load the trained sentiment analysis model and preprocessing steps
|
| 48 |
+
with warnings.catch_warnings():
|
| 49 |
+
warnings.simplefilter("ignore")
|
| 50 |
+
model = joblib.load('model.pkl')
|
| 51 |
|
| 52 |
# Function to query Hugging Face API
|
| 53 |
def query(payload, max_retries=5):
|