Spaces:
Running
Running
intemediate chnages
Browse files
app.py
CHANGED
|
@@ -28,15 +28,16 @@ def process_results(results):
|
|
| 28 |
repository = result["repository"]
|
| 29 |
license = result["license"]
|
| 30 |
language = result["language"]
|
|
|
|
| 31 |
results_html += """\
|
| 32 |
<p style='font-size:16px; text-align: left;'><b>Source: </b><span style='color: #00134d;'>{}</span> | <b>Language:</b> \
|
| 33 |
<span style='color: #00134d;'>{}</span> | <b>License: </b><span style='color: #00134d;'>{}</span></p>
|
| 34 |
<br>
|
| 35 |
-
<pre style='height:
|
| 36 |
<br>
|
| 37 |
<hr>
|
| 38 |
<br>
|
| 39 |
-
""".format(repository, language, license, text_html)
|
| 40 |
return results_html
|
| 41 |
|
| 42 |
|
|
@@ -61,7 +62,7 @@ def search(query, num_results=10):
|
|
| 61 |
print(len(response))
|
| 62 |
else:
|
| 63 |
response = match_query(query, num_results=num_results)
|
| 64 |
-
results = [{"text": hit.content, "repository": f"{hit.repository}/{hit.path}", "license": hit.license, "language": hit.language} for hit in response]
|
| 65 |
return process_results(results)
|
| 66 |
|
| 67 |
description = """# <p style="text-align: center;"><span style='color: #e6b800;'>StarCoder:</span> Dataset Search π </p>
|
|
|
|
| 28 |
repository = result["repository"]
|
| 29 |
license = result["license"]
|
| 30 |
language = result["language"]
|
| 31 |
+
code_height = min(600, len(text_html.split('\n')) * 20) # limit to maximum height of 600px
|
| 32 |
results_html += """\
|
| 33 |
<p style='font-size:16px; text-align: left;'><b>Source: </b><span style='color: #00134d;'>{}</span> | <b>Language:</b> \
|
| 34 |
<span style='color: #00134d;'>{}</span> | <b>License: </b><span style='color: #00134d;'>{}</span></p>
|
| 35 |
<br>
|
| 36 |
+
<pre style='height: {}px; overflow-y: scroll; overflow-x: hidden; color: #d9d9d9;border: 1px solid #e6b800; padding: 10px'><code>{}</code></pre>
|
| 37 |
<br>
|
| 38 |
<hr>
|
| 39 |
<br>
|
| 40 |
+
""".format(repository, language, license, code_height, text_html)
|
| 41 |
return results_html
|
| 42 |
|
| 43 |
|
|
|
|
| 62 |
print(len(response))
|
| 63 |
else:
|
| 64 |
response = match_query(query, num_results=num_results)
|
| 65 |
+
results = [{"text": hit.content, "repository": f"{hit.repository}/{hit.path}", "license": hit.license[0], "language": hit.language} for hit in response]
|
| 66 |
return process_results(results)
|
| 67 |
|
| 68 |
description = """# <p style="text-align: center;"><span style='color: #e6b800;'>StarCoder:</span> Dataset Search π </p>
|