RishabhBhardwaj commited on
Commit
bc152f8
1 Parent(s): ccd23b6
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -2,6 +2,9 @@ import streamlit as st
2
  import torch
3
  import torch.nn as nn
4
  from transformers import AutoTokenizer, AutoModelForCausalLM
 
 
 
5
 
6
  # Define the template
7
  TEMPLATE = """[INST] Evaluate if the given text is harmful i.e. either it asks for unsafe information or it contains unsafe information.
@@ -21,6 +24,13 @@ def load_model():
21
 
22
  tokenizer, model = load_model()
23
 
 
 
 
 
 
 
 
24
  # Streamlit app
25
  st.title("Text Safety Evaluator")
26
 
@@ -57,4 +67,6 @@ st.write("Connect with us at admin@walled.ai for more information.")
57
  # Add logo at the bottom center
58
  col1, col2, col3 = st.columns([1,2,1])
59
  with col2:
60
- st.image("logo.png", use_column_width=True)
 
 
 
2
  import torch
3
  import torch.nn as nn
4
  from transformers import AutoTokenizer, AutoModelForCausalLM
5
+ import requests
6
+ from PIL import Image
7
+ from io import BytesIO
8
 
9
  # Define the template
10
  TEMPLATE = """[INST] Evaluate if the given text is harmful i.e. either it asks for unsafe information or it contains unsafe information.
 
24
 
25
  tokenizer, model = load_model()
26
 
27
+ # Function to load image from URL
28
+ @st.cache_data
29
+ def load_image_from_url(url):
30
+ response = requests.get(url)
31
+ img = Image.open(BytesIO(response.content))
32
+ return img
33
+
34
  # Streamlit app
35
  st.title("Text Safety Evaluator")
36
 
 
67
  # Add logo at the bottom center
68
  col1, col2, col3 = st.columns([1,2,1])
69
  with col2:
70
+ logo_url = "https://github.com/walledai/walledeval/assets/32847115/d8b1d14f-7071-448b-8997-2eeba4c2c8f6"
71
+ logo = load_image_from_url(logo_url)
72
+ st.image(logo, use_column_width=True)