Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,19 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
import numpy as np
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
from sklearn.model_selection import train_test_split
|
| 5 |
from sklearn.svm import SVR
|
| 6 |
from sklearn.metrics import mean_squared_error
|
| 7 |
|
| 8 |
data = pd.read_csv("modeled_data.csv")
|
|
|
|
| 9 |
|
| 10 |
def sample_model(df, regressor, scale=None):
|
| 11 |
X = df.drop("rate",axis=1)
|
|
@@ -58,10 +66,16 @@ cons_tuned_svr, _, _, _, _ = sample_model(data, SVR(C=3, kernel="rbf", tol=0.001
|
|
| 58 |
with gr.Blocks() as demo:
|
| 59 |
gr.Markdown("# AIN311 Project P05 - MOOC Recommendation")
|
| 60 |
gr.Markdown("## Generating a Rating from User Comment")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
with gr.Column():
|
| 62 |
-
gr.Markdown("
|
| 63 |
-
|
| 64 |
-
|
|
|
|
|
|
|
| 65 |
comment = gr.Textbox(placeholder="Write your comment here...")
|
| 66 |
button = gr.Button("What is the Rating I Gave? Click me to Learn")
|
| 67 |
gr.Markdown("#### Sentiment Scores of Your Comment")
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
import numpy as np
|
| 4 |
+
|
| 5 |
+
!pip install langdetect
|
| 6 |
+
from langdetect import detect
|
| 7 |
+
|
| 8 |
+
! pip install vaderSentiment
|
| 9 |
+
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
|
| 10 |
+
|
| 11 |
from sklearn.model_selection import train_test_split
|
| 12 |
from sklearn.svm import SVR
|
| 13 |
from sklearn.metrics import mean_squared_error
|
| 14 |
|
| 15 |
data = pd.read_csv("modeled_data.csv")
|
| 16 |
+
analyzer = SentimentIntensityAnalyzer()
|
| 17 |
|
| 18 |
def sample_model(df, regressor, scale=None):
|
| 19 |
X = df.drop("rate",axis=1)
|
|
|
|
| 66 |
with gr.Blocks() as demo:
|
| 67 |
gr.Markdown("# AIN311 Project P05 - MOOC Recommendation")
|
| 68 |
gr.Markdown("## Generating a Rating from User Comment")
|
| 69 |
+
"""
|
| 70 |
+
# Hello World!
|
| 71 |
+
Start typing below to see the output.
|
| 72 |
+
"""
|
| 73 |
with gr.Column():
|
| 74 |
+
gr.Markdown("""
|
| 75 |
+
### Thanks for your interest and taking your time.
|
| 76 |
+
#### Tell us about your personal experience enrolling in this course. Was it the right match for you?
|
| 77 |
+
#### (Note: Comment should be written in English and be longer than 20 characters)
|
| 78 |
+
""")
|
| 79 |
comment = gr.Textbox(placeholder="Write your comment here...")
|
| 80 |
button = gr.Button("What is the Rating I Gave? Click me to Learn")
|
| 81 |
gr.Markdown("#### Sentiment Scores of Your Comment")
|