ncoop57 commited on
Commit
1d3f8ed
1 Parent(s): 0449ed9

fix bug with newlines not showing up and causing model errors

Browse files
Files changed (1) hide show
  1. app.py +4 -16
app.py CHANGED
@@ -17,19 +17,9 @@ def get_model():
17
 
18
  def format_input(question, starter_code=""):
19
  answer_type = (
20
- "\
21
- Use Call-Based format\
22
- " if starter_code else "\
23
- Use Standard Input format\
24
- "
25
  )
26
- return f"\
27
- QUESTION:\
28
- {question}\
29
- {starter_code}\
30
- {answer_type}\
31
- ANSWER:\
32
- "
33
 
34
 
35
  def clean_text(generation):
@@ -160,11 +150,9 @@ def run():
160
  st.code(output, language="python")
161
 
162
  # Create link to carbon to make a nice screenshot of the generated code
163
- url_code = urllib.parse.quote(f"# {question}\
164
- {output}")
165
- st.text("Would you like a Carbon-copy?")
166
  st.markdown(
167
- f"[Would you like a Carbon-copy?](https://carbon.now.sh/?bg=rgba%280%2C0%2C0%2C0%29&t=seti&wt=none&l=python&ds=false&dsyoff=20px&dsblur=68px&wc=true&wa=false&pv=56px&ph=56px&ln=false&fl=1&fm=Hack&fs=14px&lh=133%25&si=false&es=2x&wm=false&code={url_code})"
168
  )
169
 
170
 
17
 
18
  def format_input(question, starter_code=""):
19
  answer_type = (
20
+ "\nUse Call-Based format\n" if starter_code else "\nUse Standard Input format\n"
 
 
 
 
21
  )
22
+ return f"\nQUESTION:\n{question}\n{starter_code}\n{answer_type}\nANSWER:\n"
 
 
 
 
 
 
23
 
24
 
25
  def clean_text(generation):
150
  st.code(output, language="python")
151
 
152
  # Create link to carbon to make a nice screenshot of the generated code
153
+ url_code = urllib.parse.quote(f"# {question}\n{output}")
 
 
154
  st.markdown(
155
+ f"[Would you like a Carbon Copy?](https://carbon.now.sh/?bg=rgba%280%2C0%2C0%2C0%29&t=seti&wt=none&l=python&ds=false&dsyoff=20px&dsblur=68px&wc=true&wa=false&pv=56px&ph=56px&ln=false&fl=1&fm=Hack&fs=14px&lh=133%25&si=false&es=2x&wm=false&code={url_code})"
156
  )
157
 
158