jvroo commited on
Commit
12a2316
Β·
1 Parent(s): a0d1d61

Final Changes and README Update

Browse files
.github/workflows/discord_notification.yml DELETED
@@ -1,17 +0,0 @@
1
- name: Discord Notification
2
- on:
3
- push:
4
- branches: [main]
5
-
6
- jobs:
7
- notify:
8
- runs-on: ubuntu-latest
9
-
10
- steps:
11
- - name: Send Discord notification
12
- env:
13
- DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK }}
14
- run: |
15
- curl -X POST -H "Content-Type: application/json" \
16
- -d "{\"content\": \"A new commit was pushed to the main branch by $GITHUB_ACTOR. πŸ˜„ CS553_CaseStudy_Group 11 rock!\"}" \
17
- $DISCORD_WEBHOOK_URL
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.github/workflows/main.yml CHANGED
@@ -37,3 +37,14 @@ jobs:
37
  env:
38
  CaseStudy1: ${{ secrets.CaseStudy1 }}
39
  run: git push --force https://kroohaniwpi:$CaseStudy1@huggingface.co/spaces/ML-OPS-Grp11/CaseStudy1
 
 
 
 
 
 
 
 
 
 
 
 
37
  env:
38
  CaseStudy1: ${{ secrets.CaseStudy1 }}
39
  run: git push --force https://kroohaniwpi:$CaseStudy1@huggingface.co/spaces/ML-OPS-Grp11/CaseStudy1
40
+ notify:
41
+ runs-on: ubuntu-latest
42
+
43
+ steps:
44
+ - name: Send Discord notification
45
+ env:
46
+ DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK }}
47
+ run: |
48
+ curl -X POST -H "Content-Type: application/json" \
49
+ -d "{\"content\": \"A new commit was pushed to the main branch by $GITHUB_ACTOR. πŸ˜„ CS553_CaseStudy_Group 11 rock!\"}" \
50
+ $DISCORD_WEBHOOK_URL
README.md CHANGED
@@ -10,13 +10,39 @@ pinned: false
10
  license: mit
11
  ---
12
 
13
- An example chatbot using [Gradio](https://gradio.app), [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/v0.22.2/en/index), and the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index).
14
 
15
- Please note the makefile and github action workflow was used from https://github.com/nogibjj/hugging-face
16
 
17
- A pipeline has been added to https://github.com/jvroo/CS553CaseStudy1.git
 
18
 
19
- This is for Group 11.
20
- Authors: Keon Roohani, Shipra Poojary, Jagruti Chitte.
21
 
22
- Attempt made to connect to discord notifications.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  license: mit
11
  ---
12
 
13
+ # CS553 Case Study 1 - Group 11
14
 
15
+ A pipeline has been added to the [CS553CaseStudy1 GitHub repository](https://github.com/jvroo/CS553CaseStudy1.git) to ensure that [Hugging Face Space](https://huggingface.co/spaces/ML-OPS-Grp11/CaseStudy1) is automatically updated.
16
 
17
+ ## Group 11
18
+ **Authors**: Keon Roohani, Shipra Poojary, Jagruti Chitte
19
 
20
+ ## Assignment Overview
 
21
 
22
+ **Note**: The work done in this assignment used (Paffenroth, 2024) and (Wu, 2024) as a starting point. Additionally, ChatGPT was used on occasion for formatting of text. For instance this README was formatted as such.
23
+
24
+ ### Part 1.a: Inference Client Model
25
+ The use of a Client Inference model from Hugging Face was done using `"siebert/sentiment-roberta-large-english"`. This is a text sentiment analysis LLM for the English language (Hartmann et al., 2023).
26
+
27
+ ### Part 2.a: Local Model
28
+ The use of a local model was done using `"distilbert-base-uncased-finetuned-sst-2-english"` (Sanh et al., 2020). This is a lightweight version of BERT that can be used to classify text sentiment.
29
+
30
+ ### CI/CD Implementation
31
+ The CI/CD of this project is implemented using `main.yml`. This file ensures that pytest is run for the local model before any pushes are made to Hugging Face. After a successful test, the main commit is pushed to Hugging Face automatically. This covers sections 1.b and 2.b of the assignment.
32
+
33
+ ### Part 3: Report Submission
34
+ The report for part 3 of the Case Study is submitted on Canvas.
35
+
36
+ ### Part 4: Video Submission
37
+ The video for part 4 of the Case Study is submitted on Canvas.
38
+
39
+ ### Part 5: Discord Notifications
40
+ An attempt was made to connect to Discord notifications. This was done by creating a Discord server and a channel within it. A webhook was created and linked from the channel to the GitHub repository via the secrets in settings. A GitHub Action uses this secret to push a notification every time a commit to the main branch is made. This GitHub action can be found in `main.yml` for your reference. This covers section 5 of the assignment.
41
+
42
+ **Note**: The GitHub action workflow was used from [nogibjj's GitHub repository](https://github.com/nogibjj/hugging-face) as a reference. His corresponding YouTube video was particularly helpful, which can be found [here](https://www.youtube.com/watch?v=VYSGjUa5sc4&feature=youtu.be).
43
+
44
+ ## References
45
+ - Hartmann, J., Heitmann, M., Siebert, C., & Schamp, C. (2023). More than a Feeling: Accuracy and Application of Sentiment Analysis. *International Journal of Research in Marketing, 40*(1), 75-87.
46
+ - Sanh, V., Debut, L., Chaumond, J., & Wolf, T. (2020). DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter.
47
+ - Paffenroth (2024). Prof Paffenroth's Chatbot. [Hugging Face Space](https://huggingface.co/spaces/rcpaffenroth/chatbot).
48
+ - Wu, Y. (2024). Yang's Chatbot. [Hugging Face Space](https://huggingface.co/spaces/YangWu001/CS553_Example).
app.py CHANGED
@@ -107,20 +107,20 @@ def analyze_sentiment(movie_name, review, mode):
107
  # Return the Matplotlib figure directly to plot_output
108
  return result_text, movie_description, fig
109
 
110
- # Function to format movie information into a prettier display
111
  def format_movie_description(movie_info):
112
  if 'Error' in movie_info:
113
- return f"**Error:** {movie_info['Error']}"
114
 
115
- return f"""
116
- **🎬 Title:** {movie_info['Title']}
117
- **πŸ“… Year:** {movie_info['Year']}
118
- **πŸ‘¨β€πŸŽ€ Actors:** {movie_info['Actors']}
119
- **πŸŽ₯ Director:** {movie_info['Director']}
120
- **πŸ† Rating:** {movie_info['Rating']}
121
- **πŸ“– Genre:** {movie_info['Genre']}
122
- **πŸ“ Description:** {movie_info['Description']}
123
- """
124
 
125
  # Enhanced CSS for a modern, clean look
126
  custom_css = """
@@ -153,15 +153,6 @@ body {
153
  color: #ffffff;
154
  }
155
 
156
- .gr-markdown {
157
- margin-bottom: 20px;
158
- padding: 12px;
159
- border-radius: 8px;
160
- border: 1px solid #ddd;
161
- background-color: #ffffff;
162
- color: #333;
163
- }
164
-
165
  .gr-button {
166
  background-color: #4CAF50;
167
  color: white;
@@ -206,7 +197,7 @@ with gr.Blocks(css=custom_css) as demo:
206
 
207
  with gr.Column(scale=2):
208
  sentiment_output = gr.Textbox(label="πŸ—¨οΈ Sentiment Analysis Result", interactive=False)
209
- movie_description_output = gr.Markdown(label="πŸ“ƒ Movie Description")
210
  plot_output = gr.Plot(label="πŸ“Š Sentiment Score Graph")
211
 
212
  analyze_button.click(
 
107
  # Return the Matplotlib figure directly to plot_output
108
  return result_text, movie_description, fig
109
 
110
+ # Function to format movie information into a plain text format
111
  def format_movie_description(movie_info):
112
  if 'Error' in movie_info:
113
+ return f"Error: {movie_info['Error']}"
114
 
115
+ return (
116
+ f"Title: {movie_info['Title']}\n"
117
+ f"Year: {movie_info['Year']}\n"
118
+ f"Actors: {movie_info['Actors']}\n"
119
+ f"Director: {movie_info['Director']}\n"
120
+ f"Rating: {movie_info['Rating']}\n"
121
+ f"Genre: {movie_info['Genre']}\n"
122
+ f"Description: {movie_info['Description']}"
123
+ )
124
 
125
  # Enhanced CSS for a modern, clean look
126
  custom_css = """
 
153
  color: #ffffff;
154
  }
155
 
 
 
 
 
 
 
 
 
 
156
  .gr-button {
157
  background-color: #4CAF50;
158
  color: white;
 
197
 
198
  with gr.Column(scale=2):
199
  sentiment_output = gr.Textbox(label="πŸ—¨οΈ Sentiment Analysis Result", interactive=False)
200
+ movie_description_output = gr.Textbox(label="πŸ“ƒ Movie Description", interactive=False, lines=10)
201
  plot_output = gr.Plot(label="πŸ“Š Sentiment Score Graph")
202
 
203
  analyze_button.click(