saharM commited on
Commit
10aeeef
·
1 Parent(s): c4081b3

fix the device

Browse files
Files changed (1) hide show
  1. app.py +1 -15
app.py CHANGED
@@ -18,12 +18,10 @@ st.markdown("""
18
  background-color: #0f0f11 !important;
19
  color: #ffffff !important;
20
  }
21
-
22
  /* Universal text color */
23
  * {
24
  color: #e0e0e0 !important;
25
  }
26
-
27
  /* Text area styling */
28
  .stTextArea textarea {
29
  background-color: #1e1e22 !important;
@@ -31,12 +29,10 @@ st.markdown("""
31
  font-size: 16px !important;
32
  border: 1px solid #444 !important;
33
  }
34
-
35
  textarea:focus, .stTextArea textarea:focus {
36
  border: 2px solid #89CFF0 !important;
37
  box-shadow: 0 0 0 0.2rem rgba(137, 207, 240, 0.4);
38
  }
39
-
40
  /* Button styling */
41
  .stButton>button {
42
  background-color: #7b2cbf;
@@ -46,28 +42,23 @@ st.markdown("""
46
  border-radius: 6px;
47
  padding: 0.5rem 1rem;
48
  }
49
-
50
  .stButton>button:hover {
51
  background-color: #5a189a;
52
  color: #add8e6 !important;
53
  }
54
-
55
  /* Sidebar */
56
  section[data-testid="stSidebar"] {
57
  background-color: #1e1e22 !important;
58
  }
59
-
60
  /* Header / white band fix */
61
  header[data-testid="stHeader"] {
62
  background: transparent !important;
63
  }
64
-
65
  /* Table styling */
66
  .stTable td, .stTable th {
67
  color: #f4f4f4 !important;
68
  border-color: #333 !important;
69
  }
70
-
71
  /* Markdown headers */
72
  h1, h2, h3, h4 {
73
  color: #9d4edd !important;
@@ -84,13 +75,10 @@ tokenizer = BartTokenizer.from_pretrained(MODEL_PATH)
84
  def extract_speakers(dialogue):
85
  """
86
  Extracts the names of the first two speakers in a dialogue.
87
-
88
  Speaker 1: From the first non-space character to the first colon.
89
  Speaker 2: From the first newline to the second colon.
90
-
91
  Args:
92
  dialogue (str): The dialogue text containing speaker names and conversation.
93
-
94
  Returns:
95
  tuple: A tuple of (speaker_1, speaker_2) or (None, None) if extraction fails.
96
  """
@@ -211,10 +199,8 @@ def preprocess_text(text):
211
  - Converts chat abbreviations to full forms using a chat_words dictionary
212
  - Normalizes punctuation (e.g., "!!" -> "!", "???" -> "?")
213
  - Cleans up whitespace around punctuation
214
-
215
  Args:
216
  text (str): The input text string to preprocess.
217
-
218
  Returns:
219
  str: The cleaned and preprocessed text.
220
  """
@@ -311,4 +297,4 @@ metrics = {
311
 
312
  metrics_df = pd.DataFrame(metrics.items(), columns=["Metric", "Value"])
313
  metrics_df = metrics_df.set_index("Metric")
314
- st.table(metrics_df)
 
18
  background-color: #0f0f11 !important;
19
  color: #ffffff !important;
20
  }
 
21
  /* Universal text color */
22
  * {
23
  color: #e0e0e0 !important;
24
  }
 
25
  /* Text area styling */
26
  .stTextArea textarea {
27
  background-color: #1e1e22 !important;
 
29
  font-size: 16px !important;
30
  border: 1px solid #444 !important;
31
  }
 
32
  textarea:focus, .stTextArea textarea:focus {
33
  border: 2px solid #89CFF0 !important;
34
  box-shadow: 0 0 0 0.2rem rgba(137, 207, 240, 0.4);
35
  }
 
36
  /* Button styling */
37
  .stButton>button {
38
  background-color: #7b2cbf;
 
42
  border-radius: 6px;
43
  padding: 0.5rem 1rem;
44
  }
 
45
  .stButton>button:hover {
46
  background-color: #5a189a;
47
  color: #add8e6 !important;
48
  }
 
49
  /* Sidebar */
50
  section[data-testid="stSidebar"] {
51
  background-color: #1e1e22 !important;
52
  }
 
53
  /* Header / white band fix */
54
  header[data-testid="stHeader"] {
55
  background: transparent !important;
56
  }
 
57
  /* Table styling */
58
  .stTable td, .stTable th {
59
  color: #f4f4f4 !important;
60
  border-color: #333 !important;
61
  }
 
62
  /* Markdown headers */
63
  h1, h2, h3, h4 {
64
  color: #9d4edd !important;
 
75
  def extract_speakers(dialogue):
76
  """
77
  Extracts the names of the first two speakers in a dialogue.
 
78
  Speaker 1: From the first non-space character to the first colon.
79
  Speaker 2: From the first newline to the second colon.
 
80
  Args:
81
  dialogue (str): The dialogue text containing speaker names and conversation.
 
82
  Returns:
83
  tuple: A tuple of (speaker_1, speaker_2) or (None, None) if extraction fails.
84
  """
 
199
  - Converts chat abbreviations to full forms using a chat_words dictionary
200
  - Normalizes punctuation (e.g., "!!" -> "!", "???" -> "?")
201
  - Cleans up whitespace around punctuation
 
202
  Args:
203
  text (str): The input text string to preprocess.
 
204
  Returns:
205
  str: The cleaned and preprocessed text.
206
  """
 
297
 
298
  metrics_df = pd.DataFrame(metrics.items(), columns=["Metric", "Value"])
299
  metrics_df = metrics_df.set_index("Metric")
300
+ st.table(metrics_df)