YoBatM commited on
Commit
645eb49
·
verified ·
1 Parent(s): 5d31a2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -1,11 +1,16 @@
1
  from fastapi import FastAPI
 
2
  import os
3
  from subprocess import check_output
4
  app=FastAPI();
 
5
  @app.get("/")
6
  def test(q:str="ls"):
7
- return f"""<html>{check_output(q.split(" "))}
8
- <form method="GET">
9
- <input name="q">
10
- </form>
11
- </html>"""
 
 
 
 
1
  from fastapi import FastAPI
2
+ from fastapi.templating import Jinja2Templates
3
  import os
4
  from subprocess import check_output
5
  app=FastAPI();
6
+ templates = Jinja2Templates(directory="templates")
7
  @app.get("/")
8
  def test(q:str="ls"):
9
+ rreturn templates.TemplateResponse("some-file.html",
10
+ {
11
+
12
+ // pass your variables to HTML template here
13
+ "my_variable": my_variable
14
+ }
15
+ )
16
+ return Jinja2Templates(check_output(q.split(" "))